import webosutils from 'webosutils/index';
import {useAppStore} from "../../store/app";

export const login = function(loginForm: any) {
   // returnwebosutils.http.post('/user/login', loginForm)
}

export const menu = function() {
    //获取主题
  const useapp= useAppStore();
    webosutils.http.post("/v1/api/users/getUsertTheme",{}).then((res:any)=>{
        debugger
      // tab: true,
  //     logo: true,
  //     level: true,
  //     inverted: false,
  //     routerAlive: true,
  //     collapse: false,
  //     subfield: false,
  //     locale: "zh_CN",
  //     subfieldPosition: "side",
  //     theme: 'light',
  //     breadcrumb: true,
  //     sideWidth: "220px",
  //     sideTheme: 'dark',
  //     greyMode: false,
  //     accordion: true,
  //     tagsTheme: 'concise',
  //     keepAliveList: [],
  //     themeVariable: {
  //       "--global-checked-color": "#5fb878",
  //       "--global-primary-color": "#009688",
  //       "--global-normal-color": "#1e9fff",
  //       "--global-danger-color": "#ff5722",
  //       "--global-warm-color": "#ffb800",
  //     },
        if(res.success){
            debugger
            let theme=JSON.parse(res.data.theme);
            useapp.tab=theme.tab;
            useapp.logo=theme.logo;
            useapp.level=theme.level;
            useapp.inverted=theme.inverted;
            useapp.routerAlive=theme.routerAlive;
            useapp.collapse=theme.collapse;
            useapp.subfield=theme.subfield; 
            useapp.locale=theme.locale;
            useapp.subfieldPosition=theme.subfieldPosition;
            useapp.theme=theme.theme;
            useapp.breadcrumb=theme.breadcrumb;
            useapp.sideWidth=theme.sideWidth;
            useapp.sideTheme=theme.sideTheme;
            useapp.greyMode=theme.greyMode;
            useapp.accordion=theme.accordion;
            useapp.tagsTheme=theme.tagsTheme;
            useapp.themeVariable=theme.themeVariable;

         

        }
        //
    }).catch(err=>{
        
    });
    return webosutils.http.post("/v1/api/users/GetAppList",{}) 
}

export const permission = function() {
    //return Http.get('/user/permission') 
}